<!-- 侧边栏控件设置面板 -->
<template>
    <el-tabs modelValue="widget" stretch>
        <el-tab-pane :label="`${widget.widgetData.component.title}组件`" name="widget">
            <el-scrollbar>
                <!-- 快速制作 -->
                <row-fast-make :widget="widget" />

                <!-- 组件名称 -->
                <row-component-name :widget="widget" />

                <!-- 子组件 -->
                <row-sub-components :widget="widget" />

                <!-- 子元素 -->
                <row-child-element :widget="widget" />
                
                <!-- 元素可见设置 -->
                <row-element-visible :widget="widget" />
            </el-scrollbar>
        </el-tab-pane>

        <el-tab-pane label="组件样式" name="style">
            <el-scrollbar>
                <el-collapse modelValue="1">
                    <el-collapse-item title="组件设置" name="1">
                        <!-- 大小 -->
                        <layout-pane label="大小">
                            <si-input-number
                                v-model="widget.widgetData.eles.style.width"
                                :min="0"
                                label="宽度"
                                unit="px"
                            />
                        </layout-pane>

                        <!-- 位置 -->
                        <el-divider></el-divider>
                        <layout-pane label="位置">
                            <el-radio-group v-model="widget.widgetData.eles.customFeature.direction">
                                <el-radio label="left">置左</el-radio>
                                <el-radio label="right">置右</el-radio>
                            </el-radio-group>
                        </layout-pane>

                        <el-divider></el-divider>
                        <layout-pane label="背景">
                            <si-color-picker
                                v-model="widget.widgetData.eles.style['background-color']"
                                label="背景色"
                                show-alpha
                            />
                        </layout-pane>
                    </el-collapse-item>
                </el-collapse>
                
                <el-collapse modelValue="1">
                    <el-collapse-item title="蒙层设置" name="1">
                        <layout-pane label="颜色">
                            <si-color-picker
                                v-model="widget.widgetData.eles.customFeature.maskBackgroundColor"
                                show-alpha
                            />
                        </layout-pane>

                        <!-- 透明 -->
                        <el-divider></el-divider>
                        <si-opacity v-model="widget.widgetData.eles.customFeature.maskOpacity" />
                    </el-collapse-item>
                </el-collapse>
            </el-scrollbar>
        </el-tab-pane>
    </el-tabs>

    <row-collection :widget="widget" />
</template>

<script>
import { defineComponent, toRefs } from 'vue'
import LayoutPane from '@/components/setting-pane/layout-pane'
import {
    SiInputNumber,
    SiOpacity,
    SiColorPicker
} from '@/components/setting-pane/setting-item'
import {
    RowFastMake,
    RowSubComponents,
    RowChildElement,
    RowBackground,
    RowComponentName,
    RowElementVisible,
    RowCollection
} from '../../widget-setting-row'
export default defineComponent({
    name: 'SidebarSetting',
    components: {
        LayoutPane,
        SiInputNumber,
        SiOpacity,
        SiColorPicker,
        RowFastMake,
        RowSubComponents,
        RowChildElement,
        RowBackground,
        RowComponentName,
        RowElementVisible,
        RowCollection
    },
    props: {
        widget: {
            type: Object,
            default: () => ({})
        }
    },
    setup(props) {
        const { widget } = toRefs(props)

        return {
            widget
        }
    }
})
</script>
